<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function fn(n){
            var start = 1;
            for(var i=2; i<Math.sqrt(n) ;i++){
                if(n%i==0){
                    start = -1;
                    break;
                }
            }
            if(start == 1){
                document.write('这个数'+n+'是素数');
            }else{
                document.write('这个数'+n+'不是素数');
            }
        }
        var a = Number(prompt('输入一个数，判断它是否是素数'));
        fn(a);
    </script>
</body>
</html>